<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "presu_presupuestosinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$presu_presupuestos_edit = NULL; // Initialize page object first

class cpresu_presupuestos_edit extends cpresu_presupuestos {

	// Page ID
	var $PageID = 'edit';

	// Project ID
	var $ProjectID = "{439DA749-8B4B-4158-860B-2E007EBCC6EC}";

	// Table name
	var $TableName = 'presu_presupuestos';

	// Page object name
	var $PageObjName = 'presu_presupuestos_edit';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (presu_presupuestos)
		if (!isset($GLOBALS["presu_presupuestos"]) || get_class($GLOBALS["presu_presupuestos"]) == "cpresu_presupuestos") {
			$GLOBALS["presu_presupuestos"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["presu_presupuestos"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'edit', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'presu_presupuestos', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->PresuId->Visible = !$this->IsAdd() && !$this->IsCopy() && !$this->IsGridAdd();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter;
	var $DbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Load key from QueryString
		if (@$_GET["PresuId"] <> "") {
			$this->PresuId->setQueryStringValue($_GET["PresuId"]);
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Process form if post back
		if (@$_POST["a_edit"] <> "") {
			$this->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->LoadFormValues(); // Get form values
		} else {
			$this->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($this->PresuId->CurrentValue == "")
			$this->Page_Terminate("presu_presupuestoslist.php"); // Invalid key, return to list

		// Validate form if post back
		if (@$_POST["a_edit"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = ""; // Form error, reset action
				$this->setFailureMessage($gsFormError);
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		}
		switch ($this->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("presu_presupuestoslist.php"); // No matching record, return to list
				}
				break;
			Case "U": // Update
				$this->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("UpdateSuccess")); // Update success
					$sReturnUrl = $this->getReturnUrl();
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed
				}
		}

		// Render the record
		$this->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		if ($this->DisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->StartRec = $_GET[EW_TABLE_START_REC];
				$this->setStartRecordNumber($this->StartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$PageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($PageNo)) {
					$this->StartRec = ($PageNo-1)*$this->DisplayRecs+1;
					if ($this->StartRec <= 0) {
						$this->StartRec = 1;
					} elseif ($this->StartRec >= intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1) {
						$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1;
					}
					$this->setStartRecordNumber($this->StartRec);
				}
			}
		}
		$this->StartRec = $this->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->StartRec) || $this->StartRec == "") { // Avoid invalid start record counter
			$this->StartRec = 1; // Reset start record counter
			$this->setStartRecordNumber($this->StartRec);
		} elseif (intval($this->StartRec) > intval($this->TotalRecs)) { // Avoid starting record > total records
			$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to last page first record
			$this->setStartRecordNumber($this->StartRec);
		} elseif (($this->StartRec-1) % $this->DisplayRecs <> 0) {
			$this->StartRec = intval(($this->StartRec-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to page boundary
			$this->setStartRecordNumber($this->StartRec);
		}
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		if (!$this->PresuId->FldIsDetailKey)
			$this->PresuId->setFormValue($objForm->GetValue("x_PresuId"));
		if (!$this->PresuFechaCopia->FldIsDetailKey) {
			$this->PresuFechaCopia->setFormValue($objForm->GetValue("x_PresuFechaCopia"));
			$this->PresuFechaCopia->CurrentValue = ew_UnFormatDateTime($this->PresuFechaCopia->CurrentValue, 7);
		}
		if (!$this->PresuEstado->FldIsDetailKey) {
			$this->PresuEstado->setFormValue($objForm->GetValue("x_PresuEstado"));
		}
		if (!$this->PresuFacturaPto->FldIsDetailKey) {
			$this->PresuFacturaPto->setFormValue($objForm->GetValue("x_PresuFacturaPto"));
		}
		if (!$this->PresuFacturoTipo->FldIsDetailKey) {
			$this->PresuFacturoTipo->setFormValue($objForm->GetValue("x_PresuFacturoTipo"));
		}
		if (!$this->PresuFacturaNumero->FldIsDetailKey) {
			$this->PresuFacturaNumero->setFormValue($objForm->GetValue("x_PresuFacturaNumero"));
		}
		if (!$this->PresuMotivo->FldIsDetailKey) {
			$this->PresuMotivo->setFormValue($objForm->GetValue("x_PresuMotivo"));
		}
		if (!$this->PresFechaCierre->FldIsDetailKey) {
			$this->PresFechaCierre->setFormValue($objForm->GetValue("x_PresFechaCierre"));
			$this->PresFechaCierre->CurrentValue = ew_UnFormatDateTime($this->PresFechaCierre->CurrentValue, 7);
		}
		if (!$this->PresuReemplazado->FldIsDetailKey) {
			$this->PresuReemplazado->setFormValue($objForm->GetValue("x_PresuReemplazado"));
		}
		if (!$this->PresuSucursal->FldIsDetailKey) {
			$this->PresuSucursal->setFormValue($objForm->GetValue("x_PresuSucursal"));
		}
		if (!$this->PresuEmpresa->FldIsDetailKey) {
			$this->PresuEmpresa->setFormValue($objForm->GetValue("x_PresuEmpresa"));
		}
		if (!$this->PresuTip->FldIsDetailKey) {
			$this->PresuTip->setFormValue($objForm->GetValue("x_PresuTip"));
		}
		if (!$this->PresuLet->FldIsDetailKey) {
			$this->PresuLet->setFormValue($objForm->GetValue("x_PresuLet"));
		}
		if (!$this->PresuPun->FldIsDetailKey) {
			$this->PresuPun->setFormValue($objForm->GetValue("x_PresuPun"));
		}
		if (!$this->PresuNum->FldIsDetailKey) {
			$this->PresuNum->setFormValue($objForm->GetValue("x_PresuNum"));
		}
		if (!$this->PresuCli->FldIsDetailKey) {
			$this->PresuCli->setFormValue($objForm->GetValue("x_PresuCli"));
		}
		if (!$this->PresuRaz->FldIsDetailKey) {
			$this->PresuRaz->setFormValue($objForm->GetValue("x_PresuRaz"));
		}
		if (!$this->PresuFec1->FldIsDetailKey) {
			$this->PresuFec1->setFormValue($objForm->GetValue("x_PresuFec1"));
			$this->PresuFec1->CurrentValue = ew_UnFormatDateTime($this->PresuFec1->CurrentValue, 7);
		}
		if (!$this->PresuVen->FldIsDetailKey) {
			$this->PresuVen->setFormValue($objForm->GetValue("x_PresuVen"));
		}
		if (!$this->PresuTot->FldIsDetailKey) {
			$this->PresuTot->setFormValue($objForm->GetValue("x_PresuTot"));
		}
		if (!$this->PresuEntDir->FldIsDetailKey) {
			$this->PresuEntDir->setFormValue($objForm->GetValue("x_PresuEntDir"));
		}
		if (!$this->PresuEntLoc->FldIsDetailKey) {
			$this->PresuEntLoc->setFormValue($objForm->GetValue("x_PresuEntLoc"));
		}
		if (!$this->PresuEntTel->FldIsDetailKey) {
			$this->PresuEntTel->setFormValue($objForm->GetValue("x_PresuEntTel"));
		}
		if (!$this->PresuEntEmail->FldIsDetailKey) {
			$this->PresuEntEmail->setFormValue($objForm->GetValue("x_PresuEntEmail"));
		}
		if (!$this->PresuEntObs1->FldIsDetailKey) {
			$this->PresuEntObs1->setFormValue($objForm->GetValue("x_PresuEntObs1"));
		}
		if (!$this->PresuEntObs2->FldIsDetailKey) {
			$this->PresuEntObs2->setFormValue($objForm->GetValue("x_PresuEntObs2"));
		}
		if (!$this->PresuHor->FldIsDetailKey) {
			$this->PresuHor->setFormValue($objForm->GetValue("x_PresuHor"));
		}
		if (!$this->PresuTipoCli->FldIsDetailKey) {
			$this->PresuTipoCli->setFormValue($objForm->GetValue("x_PresuTipoCli"));
		}
		if (!$this->PresuFechaUltimaGestion->FldIsDetailKey) {
			$this->PresuFechaUltimaGestion->setFormValue($objForm->GetValue("x_PresuFechaUltimaGestion"));
			$this->PresuFechaUltimaGestion->CurrentValue = ew_UnFormatDateTime($this->PresuFechaUltimaGestion->CurrentValue, 7);
		}
		if (!$this->PresuProximoContacto->FldIsDetailKey) {
			$this->PresuProximoContacto->setFormValue($objForm->GetValue("x_PresuProximoContacto"));
			$this->PresuProximoContacto->CurrentValue = ew_UnFormatDateTime($this->PresuProximoContacto->CurrentValue, 7);
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadRow();
		$this->PresuId->CurrentValue = $this->PresuId->FormValue;
		$this->PresuFechaCopia->CurrentValue = $this->PresuFechaCopia->FormValue;
		$this->PresuFechaCopia->CurrentValue = ew_UnFormatDateTime($this->PresuFechaCopia->CurrentValue, 7);
		$this->PresuEstado->CurrentValue = $this->PresuEstado->FormValue;
		$this->PresuFacturaPto->CurrentValue = $this->PresuFacturaPto->FormValue;
		$this->PresuFacturoTipo->CurrentValue = $this->PresuFacturoTipo->FormValue;
		$this->PresuFacturaNumero->CurrentValue = $this->PresuFacturaNumero->FormValue;
		$this->PresuMotivo->CurrentValue = $this->PresuMotivo->FormValue;
		$this->PresFechaCierre->CurrentValue = $this->PresFechaCierre->FormValue;
		$this->PresFechaCierre->CurrentValue = ew_UnFormatDateTime($this->PresFechaCierre->CurrentValue, 7);
		$this->PresuReemplazado->CurrentValue = $this->PresuReemplazado->FormValue;
		$this->PresuSucursal->CurrentValue = $this->PresuSucursal->FormValue;
		$this->PresuEmpresa->CurrentValue = $this->PresuEmpresa->FormValue;
		$this->PresuTip->CurrentValue = $this->PresuTip->FormValue;
		$this->PresuLet->CurrentValue = $this->PresuLet->FormValue;
		$this->PresuPun->CurrentValue = $this->PresuPun->FormValue;
		$this->PresuNum->CurrentValue = $this->PresuNum->FormValue;
		$this->PresuCli->CurrentValue = $this->PresuCli->FormValue;
		$this->PresuRaz->CurrentValue = $this->PresuRaz->FormValue;
		$this->PresuFec1->CurrentValue = $this->PresuFec1->FormValue;
		$this->PresuFec1->CurrentValue = ew_UnFormatDateTime($this->PresuFec1->CurrentValue, 7);
		$this->PresuVen->CurrentValue = $this->PresuVen->FormValue;
		$this->PresuTot->CurrentValue = $this->PresuTot->FormValue;
		$this->PresuEntDir->CurrentValue = $this->PresuEntDir->FormValue;
		$this->PresuEntLoc->CurrentValue = $this->PresuEntLoc->FormValue;
		$this->PresuEntTel->CurrentValue = $this->PresuEntTel->FormValue;
		$this->PresuEntEmail->CurrentValue = $this->PresuEntEmail->FormValue;
		$this->PresuEntObs1->CurrentValue = $this->PresuEntObs1->FormValue;
		$this->PresuEntObs2->CurrentValue = $this->PresuEntObs2->FormValue;
		$this->PresuHor->CurrentValue = $this->PresuHor->FormValue;
		$this->PresuTipoCli->CurrentValue = $this->PresuTipoCli->FormValue;
		$this->PresuFechaUltimaGestion->CurrentValue = $this->PresuFechaUltimaGestion->FormValue;
		$this->PresuFechaUltimaGestion->CurrentValue = ew_UnFormatDateTime($this->PresuFechaUltimaGestion->CurrentValue, 7);
		$this->PresuProximoContacto->CurrentValue = $this->PresuProximoContacto->FormValue;
		$this->PresuProximoContacto->CurrentValue = ew_UnFormatDateTime($this->PresuProximoContacto->CurrentValue, 7);
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->PresuId->setDbValue($rs->fields('PresuId'));
		$this->PresuFechaCopia->setDbValue($rs->fields('PresuFechaCopia'));
		$this->PresuEstado->setDbValue($rs->fields('PresuEstado'));
		$this->PresuFacturaPto->setDbValue($rs->fields('PresuFacturaPto'));
		$this->PresuFacturoTipo->setDbValue($rs->fields('PresuFacturoTipo'));
		$this->PresuFacturaNumero->setDbValue($rs->fields('PresuFacturaNumero'));
		$this->PresuMotivo->setDbValue($rs->fields('PresuMotivo'));
		$this->PresFechaCierre->setDbValue($rs->fields('PresFechaCierre'));
		$this->PresuReemplazado->setDbValue($rs->fields('PresuReemplazado'));
		$this->PresuSucursal->setDbValue($rs->fields('PresuSucursal'));
		$this->PresuEmpresa->setDbValue($rs->fields('PresuEmpresa'));
		$this->PresuTip->setDbValue($rs->fields('PresuTip'));
		$this->PresuLet->setDbValue($rs->fields('PresuLet'));
		$this->PresuPun->setDbValue($rs->fields('PresuPun'));
		$this->PresuNum->setDbValue($rs->fields('PresuNum'));
		$this->PresuCli->setDbValue($rs->fields('PresuCli'));
		$this->PresuRaz->setDbValue($rs->fields('PresuRaz'));
		$this->PresuFec1->setDbValue($rs->fields('PresuFec1'));
		$this->PresuVen->setDbValue($rs->fields('PresuVen'));
		$this->PresuTot->setDbValue($rs->fields('PresuTot'));
		$this->PresuEntDir->setDbValue($rs->fields('PresuEntDir'));
		$this->PresuEntLoc->setDbValue($rs->fields('PresuEntLoc'));
		$this->PresuEntTel->setDbValue($rs->fields('PresuEntTel'));
		$this->PresuEntEmail->setDbValue($rs->fields('PresuEntEmail'));
		$this->PresuEntObs1->setDbValue($rs->fields('PresuEntObs1'));
		$this->PresuEntObs2->setDbValue($rs->fields('PresuEntObs2'));
		$this->PresuHor->setDbValue($rs->fields('PresuHor'));
		$this->PresuTipoCli->setDbValue($rs->fields('PresuTipoCli'));
		$this->PresuFechaUltimaGestion->setDbValue($rs->fields('PresuFechaUltimaGestion'));
		$this->PresuProximoContacto->setDbValue($rs->fields('PresuProximoContacto'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->PresuId->DbValue = $row['PresuId'];
		$this->PresuFechaCopia->DbValue = $row['PresuFechaCopia'];
		$this->PresuEstado->DbValue = $row['PresuEstado'];
		$this->PresuFacturaPto->DbValue = $row['PresuFacturaPto'];
		$this->PresuFacturoTipo->DbValue = $row['PresuFacturoTipo'];
		$this->PresuFacturaNumero->DbValue = $row['PresuFacturaNumero'];
		$this->PresuMotivo->DbValue = $row['PresuMotivo'];
		$this->PresFechaCierre->DbValue = $row['PresFechaCierre'];
		$this->PresuReemplazado->DbValue = $row['PresuReemplazado'];
		$this->PresuSucursal->DbValue = $row['PresuSucursal'];
		$this->PresuEmpresa->DbValue = $row['PresuEmpresa'];
		$this->PresuTip->DbValue = $row['PresuTip'];
		$this->PresuLet->DbValue = $row['PresuLet'];
		$this->PresuPun->DbValue = $row['PresuPun'];
		$this->PresuNum->DbValue = $row['PresuNum'];
		$this->PresuCli->DbValue = $row['PresuCli'];
		$this->PresuRaz->DbValue = $row['PresuRaz'];
		$this->PresuFec1->DbValue = $row['PresuFec1'];
		$this->PresuVen->DbValue = $row['PresuVen'];
		$this->PresuTot->DbValue = $row['PresuTot'];
		$this->PresuEntDir->DbValue = $row['PresuEntDir'];
		$this->PresuEntLoc->DbValue = $row['PresuEntLoc'];
		$this->PresuEntTel->DbValue = $row['PresuEntTel'];
		$this->PresuEntEmail->DbValue = $row['PresuEntEmail'];
		$this->PresuEntObs1->DbValue = $row['PresuEntObs1'];
		$this->PresuEntObs2->DbValue = $row['PresuEntObs2'];
		$this->PresuHor->DbValue = $row['PresuHor'];
		$this->PresuTipoCli->DbValue = $row['PresuTipoCli'];
		$this->PresuFechaUltimaGestion->DbValue = $row['PresuFechaUltimaGestion'];
		$this->PresuProximoContacto->DbValue = $row['PresuProximoContacto'];
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Convert decimal values if posted back

		if ($this->PresuTot->FormValue == $this->PresuTot->CurrentValue && is_numeric(ew_StrToFloat($this->PresuTot->CurrentValue)))
			$this->PresuTot->CurrentValue = ew_StrToFloat($this->PresuTot->CurrentValue);

		// Call Row_Rendering event
		$this->Row_Rendering();

		// Common render codes for all row types
		// PresuId
		// PresuFechaCopia
		// PresuEstado
		// PresuFacturaPto
		// PresuFacturoTipo
		// PresuFacturaNumero
		// PresuMotivo
		// PresFechaCierre
		// PresuReemplazado
		// PresuSucursal
		// PresuEmpresa
		// PresuTip
		// PresuLet
		// PresuPun
		// PresuNum
		// PresuCli
		// PresuRaz
		// PresuFec1
		// PresuVen
		// PresuTot
		// PresuEntDir
		// PresuEntLoc
		// PresuEntTel
		// PresuEntEmail
		// PresuEntObs1
		// PresuEntObs2
		// PresuHor
		// PresuTipoCli
		// PresuFechaUltimaGestion
		// PresuProximoContacto

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// PresuId
			$this->PresuId->ViewValue = $this->PresuId->CurrentValue;
			$this->PresuId->ViewCustomAttributes = "";

			// PresuFechaCopia
			$this->PresuFechaCopia->ViewValue = $this->PresuFechaCopia->CurrentValue;
			$this->PresuFechaCopia->ViewValue = ew_FormatDateTime($this->PresuFechaCopia->ViewValue, 7);
			$this->PresuFechaCopia->ViewCustomAttributes = "";

			// PresuEstado
			$this->PresuEstado->ViewValue = $this->PresuEstado->CurrentValue;
			$this->PresuEstado->ViewCustomAttributes = "";

			// PresuFacturaPto
			$this->PresuFacturaPto->ViewValue = $this->PresuFacturaPto->CurrentValue;
			$this->PresuFacturaPto->ViewCustomAttributes = "";

			// PresuFacturoTipo
			$this->PresuFacturoTipo->ViewValue = $this->PresuFacturoTipo->CurrentValue;
			$this->PresuFacturoTipo->ViewCustomAttributes = "";

			// PresuFacturaNumero
			$this->PresuFacturaNumero->ViewValue = $this->PresuFacturaNumero->CurrentValue;
			$this->PresuFacturaNumero->ViewCustomAttributes = "";

			// PresuMotivo
			$this->PresuMotivo->ViewValue = $this->PresuMotivo->CurrentValue;
			$this->PresuMotivo->ViewCustomAttributes = "";

			// PresFechaCierre
			$this->PresFechaCierre->ViewValue = $this->PresFechaCierre->CurrentValue;
			$this->PresFechaCierre->ViewValue = ew_FormatDateTime($this->PresFechaCierre->ViewValue, 7);
			$this->PresFechaCierre->ViewCustomAttributes = "";

			// PresuReemplazado
			$this->PresuReemplazado->ViewValue = $this->PresuReemplazado->CurrentValue;
			$this->PresuReemplazado->ViewCustomAttributes = "";

			// PresuSucursal
			$this->PresuSucursal->ViewValue = $this->PresuSucursal->CurrentValue;
			$this->PresuSucursal->ViewCustomAttributes = "";

			// PresuEmpresa
			$this->PresuEmpresa->ViewValue = $this->PresuEmpresa->CurrentValue;
			$this->PresuEmpresa->ViewCustomAttributes = "";

			// PresuTip
			$this->PresuTip->ViewValue = $this->PresuTip->CurrentValue;
			$this->PresuTip->ViewCustomAttributes = "";

			// PresuLet
			$this->PresuLet->ViewValue = $this->PresuLet->CurrentValue;
			$this->PresuLet->ViewCustomAttributes = "";

			// PresuPun
			$this->PresuPun->ViewValue = $this->PresuPun->CurrentValue;
			$this->PresuPun->ViewCustomAttributes = "";

			// PresuNum
			$this->PresuNum->ViewValue = $this->PresuNum->CurrentValue;
			$this->PresuNum->ViewCustomAttributes = "";

			// PresuCli
			$this->PresuCli->ViewValue = $this->PresuCli->CurrentValue;
			$this->PresuCli->ViewCustomAttributes = "";

			// PresuRaz
			$this->PresuRaz->ViewValue = $this->PresuRaz->CurrentValue;
			$this->PresuRaz->ViewCustomAttributes = "";

			// PresuFec1
			$this->PresuFec1->ViewValue = $this->PresuFec1->CurrentValue;
			$this->PresuFec1->ViewValue = ew_FormatDateTime($this->PresuFec1->ViewValue, 7);
			$this->PresuFec1->ViewCustomAttributes = "";

			// PresuVen
			$this->PresuVen->ViewValue = $this->PresuVen->CurrentValue;
			$this->PresuVen->ViewCustomAttributes = "";

			// PresuTot
			$this->PresuTot->ViewValue = $this->PresuTot->CurrentValue;
			$this->PresuTot->ViewCustomAttributes = "";

			// PresuEntDir
			$this->PresuEntDir->ViewValue = $this->PresuEntDir->CurrentValue;
			$this->PresuEntDir->ViewCustomAttributes = "";

			// PresuEntLoc
			$this->PresuEntLoc->ViewValue = $this->PresuEntLoc->CurrentValue;
			$this->PresuEntLoc->ViewCustomAttributes = "";

			// PresuEntTel
			$this->PresuEntTel->ViewValue = $this->PresuEntTel->CurrentValue;
			$this->PresuEntTel->ViewCustomAttributes = "";

			// PresuEntEmail
			$this->PresuEntEmail->ViewValue = $this->PresuEntEmail->CurrentValue;
			$this->PresuEntEmail->ViewCustomAttributes = "";

			// PresuEntObs1
			$this->PresuEntObs1->ViewValue = $this->PresuEntObs1->CurrentValue;
			$this->PresuEntObs1->ViewCustomAttributes = "";

			// PresuEntObs2
			$this->PresuEntObs2->ViewValue = $this->PresuEntObs2->CurrentValue;
			$this->PresuEntObs2->ViewCustomAttributes = "";

			// PresuHor
			$this->PresuHor->ViewValue = $this->PresuHor->CurrentValue;
			$this->PresuHor->ViewCustomAttributes = "";

			// PresuTipoCli
			$this->PresuTipoCli->ViewValue = $this->PresuTipoCli->CurrentValue;
			$this->PresuTipoCli->ViewCustomAttributes = "";

			// PresuFechaUltimaGestion
			$this->PresuFechaUltimaGestion->ViewValue = $this->PresuFechaUltimaGestion->CurrentValue;
			$this->PresuFechaUltimaGestion->ViewValue = ew_FormatDateTime($this->PresuFechaUltimaGestion->ViewValue, 7);
			$this->PresuFechaUltimaGestion->ViewCustomAttributes = "";

			// PresuProximoContacto
			$this->PresuProximoContacto->ViewValue = $this->PresuProximoContacto->CurrentValue;
			$this->PresuProximoContacto->ViewValue = ew_FormatDateTime($this->PresuProximoContacto->ViewValue, 7);
			$this->PresuProximoContacto->ViewCustomAttributes = "";

			// PresuId
			$this->PresuId->LinkCustomAttributes = "";
			$this->PresuId->HrefValue = "";
			$this->PresuId->TooltipValue = "";

			// PresuFechaCopia
			$this->PresuFechaCopia->LinkCustomAttributes = "";
			$this->PresuFechaCopia->HrefValue = "";
			$this->PresuFechaCopia->TooltipValue = "";

			// PresuEstado
			$this->PresuEstado->LinkCustomAttributes = "";
			$this->PresuEstado->HrefValue = "";
			$this->PresuEstado->TooltipValue = "";

			// PresuFacturaPto
			$this->PresuFacturaPto->LinkCustomAttributes = "";
			$this->PresuFacturaPto->HrefValue = "";
			$this->PresuFacturaPto->TooltipValue = "";

			// PresuFacturoTipo
			$this->PresuFacturoTipo->LinkCustomAttributes = "";
			$this->PresuFacturoTipo->HrefValue = "";
			$this->PresuFacturoTipo->TooltipValue = "";

			// PresuFacturaNumero
			$this->PresuFacturaNumero->LinkCustomAttributes = "";
			$this->PresuFacturaNumero->HrefValue = "";
			$this->PresuFacturaNumero->TooltipValue = "";

			// PresuMotivo
			$this->PresuMotivo->LinkCustomAttributes = "";
			$this->PresuMotivo->HrefValue = "";
			$this->PresuMotivo->TooltipValue = "";

			// PresFechaCierre
			$this->PresFechaCierre->LinkCustomAttributes = "";
			$this->PresFechaCierre->HrefValue = "";
			$this->PresFechaCierre->TooltipValue = "";

			// PresuReemplazado
			$this->PresuReemplazado->LinkCustomAttributes = "";
			$this->PresuReemplazado->HrefValue = "";
			$this->PresuReemplazado->TooltipValue = "";

			// PresuSucursal
			$this->PresuSucursal->LinkCustomAttributes = "";
			$this->PresuSucursal->HrefValue = "";
			$this->PresuSucursal->TooltipValue = "";

			// PresuEmpresa
			$this->PresuEmpresa->LinkCustomAttributes = "";
			$this->PresuEmpresa->HrefValue = "";
			$this->PresuEmpresa->TooltipValue = "";

			// PresuTip
			$this->PresuTip->LinkCustomAttributes = "";
			$this->PresuTip->HrefValue = "";
			$this->PresuTip->TooltipValue = "";

			// PresuLet
			$this->PresuLet->LinkCustomAttributes = "";
			$this->PresuLet->HrefValue = "";
			$this->PresuLet->TooltipValue = "";

			// PresuPun
			$this->PresuPun->LinkCustomAttributes = "";
			$this->PresuPun->HrefValue = "";
			$this->PresuPun->TooltipValue = "";

			// PresuNum
			$this->PresuNum->LinkCustomAttributes = "";
			$this->PresuNum->HrefValue = "";
			$this->PresuNum->TooltipValue = "";

			// PresuCli
			$this->PresuCli->LinkCustomAttributes = "";
			$this->PresuCli->HrefValue = "";
			$this->PresuCli->TooltipValue = "";

			// PresuRaz
			$this->PresuRaz->LinkCustomAttributes = "";
			$this->PresuRaz->HrefValue = "";
			$this->PresuRaz->TooltipValue = "";

			// PresuFec1
			$this->PresuFec1->LinkCustomAttributes = "";
			$this->PresuFec1->HrefValue = "";
			$this->PresuFec1->TooltipValue = "";

			// PresuVen
			$this->PresuVen->LinkCustomAttributes = "";
			$this->PresuVen->HrefValue = "";
			$this->PresuVen->TooltipValue = "";

			// PresuTot
			$this->PresuTot->LinkCustomAttributes = "";
			$this->PresuTot->HrefValue = "";
			$this->PresuTot->TooltipValue = "";

			// PresuEntDir
			$this->PresuEntDir->LinkCustomAttributes = "";
			$this->PresuEntDir->HrefValue = "";
			$this->PresuEntDir->TooltipValue = "";

			// PresuEntLoc
			$this->PresuEntLoc->LinkCustomAttributes = "";
			$this->PresuEntLoc->HrefValue = "";
			$this->PresuEntLoc->TooltipValue = "";

			// PresuEntTel
			$this->PresuEntTel->LinkCustomAttributes = "";
			$this->PresuEntTel->HrefValue = "";
			$this->PresuEntTel->TooltipValue = "";

			// PresuEntEmail
			$this->PresuEntEmail->LinkCustomAttributes = "";
			$this->PresuEntEmail->HrefValue = "";
			$this->PresuEntEmail->TooltipValue = "";

			// PresuEntObs1
			$this->PresuEntObs1->LinkCustomAttributes = "";
			$this->PresuEntObs1->HrefValue = "";
			$this->PresuEntObs1->TooltipValue = "";

			// PresuEntObs2
			$this->PresuEntObs2->LinkCustomAttributes = "";
			$this->PresuEntObs2->HrefValue = "";
			$this->PresuEntObs2->TooltipValue = "";

			// PresuHor
			$this->PresuHor->LinkCustomAttributes = "";
			$this->PresuHor->HrefValue = "";
			$this->PresuHor->TooltipValue = "";

			// PresuTipoCli
			$this->PresuTipoCli->LinkCustomAttributes = "";
			$this->PresuTipoCli->HrefValue = "";
			$this->PresuTipoCli->TooltipValue = "";

			// PresuFechaUltimaGestion
			$this->PresuFechaUltimaGestion->LinkCustomAttributes = "";
			$this->PresuFechaUltimaGestion->HrefValue = "";
			$this->PresuFechaUltimaGestion->TooltipValue = "";

			// PresuProximoContacto
			$this->PresuProximoContacto->LinkCustomAttributes = "";
			$this->PresuProximoContacto->HrefValue = "";
			$this->PresuProximoContacto->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// PresuId
			$this->PresuId->EditCustomAttributes = "";
			$this->PresuId->EditValue = $this->PresuId->CurrentValue;
			$this->PresuId->ViewCustomAttributes = "";

			// PresuFechaCopia
			$this->PresuFechaCopia->EditCustomAttributes = "";
			$this->PresuFechaCopia->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->PresuFechaCopia->CurrentValue, 7));
			$this->PresuFechaCopia->PlaceHolder = ew_RemoveHtml($this->PresuFechaCopia->FldCaption());

			// PresuEstado
			$this->PresuEstado->EditCustomAttributes = "";
			$this->PresuEstado->EditValue = ew_HtmlEncode($this->PresuEstado->CurrentValue);
			$this->PresuEstado->PlaceHolder = ew_RemoveHtml($this->PresuEstado->FldCaption());

			// PresuFacturaPto
			$this->PresuFacturaPto->EditCustomAttributes = "";
			$this->PresuFacturaPto->EditValue = ew_HtmlEncode($this->PresuFacturaPto->CurrentValue);
			$this->PresuFacturaPto->PlaceHolder = ew_RemoveHtml($this->PresuFacturaPto->FldCaption());

			// PresuFacturoTipo
			$this->PresuFacturoTipo->EditCustomAttributes = "";
			$this->PresuFacturoTipo->EditValue = ew_HtmlEncode($this->PresuFacturoTipo->CurrentValue);
			$this->PresuFacturoTipo->PlaceHolder = ew_RemoveHtml($this->PresuFacturoTipo->FldCaption());

			// PresuFacturaNumero
			$this->PresuFacturaNumero->EditCustomAttributes = "";
			$this->PresuFacturaNumero->EditValue = ew_HtmlEncode($this->PresuFacturaNumero->CurrentValue);
			$this->PresuFacturaNumero->PlaceHolder = ew_RemoveHtml($this->PresuFacturaNumero->FldCaption());

			// PresuMotivo
			$this->PresuMotivo->EditCustomAttributes = "";
			$this->PresuMotivo->EditValue = ew_HtmlEncode($this->PresuMotivo->CurrentValue);
			$this->PresuMotivo->PlaceHolder = ew_RemoveHtml($this->PresuMotivo->FldCaption());

			// PresFechaCierre
			$this->PresFechaCierre->EditCustomAttributes = "";
			$this->PresFechaCierre->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->PresFechaCierre->CurrentValue, 7));
			$this->PresFechaCierre->PlaceHolder = ew_RemoveHtml($this->PresFechaCierre->FldCaption());

			// PresuReemplazado
			$this->PresuReemplazado->EditCustomAttributes = "";
			$this->PresuReemplazado->EditValue = ew_HtmlEncode($this->PresuReemplazado->CurrentValue);
			$this->PresuReemplazado->PlaceHolder = ew_RemoveHtml($this->PresuReemplazado->FldCaption());

			// PresuSucursal
			$this->PresuSucursal->EditCustomAttributes = "";
			$this->PresuSucursal->EditValue = ew_HtmlEncode($this->PresuSucursal->CurrentValue);
			$this->PresuSucursal->PlaceHolder = ew_RemoveHtml($this->PresuSucursal->FldCaption());

			// PresuEmpresa
			$this->PresuEmpresa->EditCustomAttributes = "";
			$this->PresuEmpresa->EditValue = ew_HtmlEncode($this->PresuEmpresa->CurrentValue);
			$this->PresuEmpresa->PlaceHolder = ew_RemoveHtml($this->PresuEmpresa->FldCaption());

			// PresuTip
			$this->PresuTip->EditCustomAttributes = "";
			$this->PresuTip->EditValue = ew_HtmlEncode($this->PresuTip->CurrentValue);
			$this->PresuTip->PlaceHolder = ew_RemoveHtml($this->PresuTip->FldCaption());

			// PresuLet
			$this->PresuLet->EditCustomAttributes = "";
			$this->PresuLet->EditValue = ew_HtmlEncode($this->PresuLet->CurrentValue);
			$this->PresuLet->PlaceHolder = ew_RemoveHtml($this->PresuLet->FldCaption());

			// PresuPun
			$this->PresuPun->EditCustomAttributes = "";
			$this->PresuPun->EditValue = ew_HtmlEncode($this->PresuPun->CurrentValue);
			$this->PresuPun->PlaceHolder = ew_RemoveHtml($this->PresuPun->FldCaption());

			// PresuNum
			$this->PresuNum->EditCustomAttributes = "";
			$this->PresuNum->EditValue = ew_HtmlEncode($this->PresuNum->CurrentValue);
			$this->PresuNum->PlaceHolder = ew_RemoveHtml($this->PresuNum->FldCaption());

			// PresuCli
			$this->PresuCli->EditCustomAttributes = "";
			$this->PresuCli->EditValue = ew_HtmlEncode($this->PresuCli->CurrentValue);
			$this->PresuCli->PlaceHolder = ew_RemoveHtml($this->PresuCli->FldCaption());

			// PresuRaz
			$this->PresuRaz->EditCustomAttributes = "";
			$this->PresuRaz->EditValue = ew_HtmlEncode($this->PresuRaz->CurrentValue);
			$this->PresuRaz->PlaceHolder = ew_RemoveHtml($this->PresuRaz->FldCaption());

			// PresuFec1
			$this->PresuFec1->EditCustomAttributes = "";
			$this->PresuFec1->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->PresuFec1->CurrentValue, 7));
			$this->PresuFec1->PlaceHolder = ew_RemoveHtml($this->PresuFec1->FldCaption());

			// PresuVen
			$this->PresuVen->EditCustomAttributes = "";
			$this->PresuVen->EditValue = ew_HtmlEncode($this->PresuVen->CurrentValue);
			$this->PresuVen->PlaceHolder = ew_RemoveHtml($this->PresuVen->FldCaption());

			// PresuTot
			$this->PresuTot->EditCustomAttributes = "";
			$this->PresuTot->EditValue = ew_HtmlEncode($this->PresuTot->CurrentValue);
			$this->PresuTot->PlaceHolder = ew_RemoveHtml($this->PresuTot->FldCaption());
			if (strval($this->PresuTot->EditValue) <> "" && is_numeric($this->PresuTot->EditValue)) $this->PresuTot->EditValue = ew_FormatNumber($this->PresuTot->EditValue, -2, -1, -2, 0);

			// PresuEntDir
			$this->PresuEntDir->EditCustomAttributes = "";
			$this->PresuEntDir->EditValue = ew_HtmlEncode($this->PresuEntDir->CurrentValue);
			$this->PresuEntDir->PlaceHolder = ew_RemoveHtml($this->PresuEntDir->FldCaption());

			// PresuEntLoc
			$this->PresuEntLoc->EditCustomAttributes = "";
			$this->PresuEntLoc->EditValue = ew_HtmlEncode($this->PresuEntLoc->CurrentValue);
			$this->PresuEntLoc->PlaceHolder = ew_RemoveHtml($this->PresuEntLoc->FldCaption());

			// PresuEntTel
			$this->PresuEntTel->EditCustomAttributes = "";
			$this->PresuEntTel->EditValue = ew_HtmlEncode($this->PresuEntTel->CurrentValue);
			$this->PresuEntTel->PlaceHolder = ew_RemoveHtml($this->PresuEntTel->FldCaption());

			// PresuEntEmail
			$this->PresuEntEmail->EditCustomAttributes = "";
			$this->PresuEntEmail->EditValue = ew_HtmlEncode($this->PresuEntEmail->CurrentValue);
			$this->PresuEntEmail->PlaceHolder = ew_RemoveHtml($this->PresuEntEmail->FldCaption());

			// PresuEntObs1
			$this->PresuEntObs1->EditCustomAttributes = "";
			$this->PresuEntObs1->EditValue = ew_HtmlEncode($this->PresuEntObs1->CurrentValue);
			$this->PresuEntObs1->PlaceHolder = ew_RemoveHtml($this->PresuEntObs1->FldCaption());

			// PresuEntObs2
			$this->PresuEntObs2->EditCustomAttributes = "";
			$this->PresuEntObs2->EditValue = ew_HtmlEncode($this->PresuEntObs2->CurrentValue);
			$this->PresuEntObs2->PlaceHolder = ew_RemoveHtml($this->PresuEntObs2->FldCaption());

			// PresuHor
			$this->PresuHor->EditCustomAttributes = "";
			$this->PresuHor->EditValue = ew_HtmlEncode($this->PresuHor->CurrentValue);
			$this->PresuHor->PlaceHolder = ew_RemoveHtml($this->PresuHor->FldCaption());

			// PresuTipoCli
			$this->PresuTipoCli->EditCustomAttributes = "";
			$this->PresuTipoCli->EditValue = ew_HtmlEncode($this->PresuTipoCli->CurrentValue);
			$this->PresuTipoCli->PlaceHolder = ew_RemoveHtml($this->PresuTipoCli->FldCaption());

			// PresuFechaUltimaGestion
			$this->PresuFechaUltimaGestion->EditCustomAttributes = "";
			$this->PresuFechaUltimaGestion->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->PresuFechaUltimaGestion->CurrentValue, 7));
			$this->PresuFechaUltimaGestion->PlaceHolder = ew_RemoveHtml($this->PresuFechaUltimaGestion->FldCaption());

			// PresuProximoContacto
			$this->PresuProximoContacto->EditCustomAttributes = "";
			$this->PresuProximoContacto->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->PresuProximoContacto->CurrentValue, 7));
			$this->PresuProximoContacto->PlaceHolder = ew_RemoveHtml($this->PresuProximoContacto->FldCaption());

			// Edit refer script
			// PresuId

			$this->PresuId->HrefValue = "";

			// PresuFechaCopia
			$this->PresuFechaCopia->HrefValue = "";

			// PresuEstado
			$this->PresuEstado->HrefValue = "";

			// PresuFacturaPto
			$this->PresuFacturaPto->HrefValue = "";

			// PresuFacturoTipo
			$this->PresuFacturoTipo->HrefValue = "";

			// PresuFacturaNumero
			$this->PresuFacturaNumero->HrefValue = "";

			// PresuMotivo
			$this->PresuMotivo->HrefValue = "";

			// PresFechaCierre
			$this->PresFechaCierre->HrefValue = "";

			// PresuReemplazado
			$this->PresuReemplazado->HrefValue = "";

			// PresuSucursal
			$this->PresuSucursal->HrefValue = "";

			// PresuEmpresa
			$this->PresuEmpresa->HrefValue = "";

			// PresuTip
			$this->PresuTip->HrefValue = "";

			// PresuLet
			$this->PresuLet->HrefValue = "";

			// PresuPun
			$this->PresuPun->HrefValue = "";

			// PresuNum
			$this->PresuNum->HrefValue = "";

			// PresuCli
			$this->PresuCli->HrefValue = "";

			// PresuRaz
			$this->PresuRaz->HrefValue = "";

			// PresuFec1
			$this->PresuFec1->HrefValue = "";

			// PresuVen
			$this->PresuVen->HrefValue = "";

			// PresuTot
			$this->PresuTot->HrefValue = "";

			// PresuEntDir
			$this->PresuEntDir->HrefValue = "";

			// PresuEntLoc
			$this->PresuEntLoc->HrefValue = "";

			// PresuEntTel
			$this->PresuEntTel->HrefValue = "";

			// PresuEntEmail
			$this->PresuEntEmail->HrefValue = "";

			// PresuEntObs1
			$this->PresuEntObs1->HrefValue = "";

			// PresuEntObs2
			$this->PresuEntObs2->HrefValue = "";

			// PresuHor
			$this->PresuHor->HrefValue = "";

			// PresuTipoCli
			$this->PresuTipoCli->HrefValue = "";

			// PresuFechaUltimaGestion
			$this->PresuFechaUltimaGestion->HrefValue = "";

			// PresuProximoContacto
			$this->PresuProximoContacto->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckEuroDate($this->PresuFechaCopia->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuFechaCopia->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuEstado->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuEstado->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuFacturaPto->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuFacturaPto->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuFacturaNumero->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuFacturaNumero->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuMotivo->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuMotivo->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->PresFechaCierre->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresFechaCierre->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuReemplazado->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuReemplazado->FldErrMsg());
		}
		if (!$this->PresuSucursal->FldIsDetailKey && !is_null($this->PresuSucursal->FormValue) && $this->PresuSucursal->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuSucursal->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuSucursal->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuSucursal->FldErrMsg());
		}
		if (!$this->PresuEmpresa->FldIsDetailKey && !is_null($this->PresuEmpresa->FormValue) && $this->PresuEmpresa->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEmpresa->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuEmpresa->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuEmpresa->FldErrMsg());
		}
		if (!$this->PresuTip->FldIsDetailKey && !is_null($this->PresuTip->FormValue) && $this->PresuTip->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuTip->FldCaption());
		}
		if (!$this->PresuLet->FldIsDetailKey && !is_null($this->PresuLet->FormValue) && $this->PresuLet->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuLet->FldCaption());
		}
		if (!$this->PresuPun->FldIsDetailKey && !is_null($this->PresuPun->FormValue) && $this->PresuPun->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuPun->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuPun->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuPun->FldErrMsg());
		}
		if (!$this->PresuNum->FldIsDetailKey && !is_null($this->PresuNum->FormValue) && $this->PresuNum->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuNum->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuNum->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuNum->FldErrMsg());
		}
		if (!$this->PresuCli->FldIsDetailKey && !is_null($this->PresuCli->FormValue) && $this->PresuCli->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuCli->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuCli->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuCli->FldErrMsg());
		}
		if (!$this->PresuRaz->FldIsDetailKey && !is_null($this->PresuRaz->FormValue) && $this->PresuRaz->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuRaz->FldCaption());
		}
		if (!$this->PresuFec1->FldIsDetailKey && !is_null($this->PresuFec1->FormValue) && $this->PresuFec1->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuFec1->FldCaption());
		}
		if (!ew_CheckEuroDate($this->PresuFec1->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuFec1->FldErrMsg());
		}
		if (!$this->PresuVen->FldIsDetailKey && !is_null($this->PresuVen->FormValue) && $this->PresuVen->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuVen->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuVen->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuVen->FldErrMsg());
		}
		if (!$this->PresuTot->FldIsDetailKey && !is_null($this->PresuTot->FormValue) && $this->PresuTot->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuTot->FldCaption());
		}
		if (!ew_CheckNumber($this->PresuTot->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuTot->FldErrMsg());
		}
		if (!$this->PresuEntDir->FldIsDetailKey && !is_null($this->PresuEntDir->FormValue) && $this->PresuEntDir->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEntDir->FldCaption());
		}
		if (!$this->PresuEntLoc->FldIsDetailKey && !is_null($this->PresuEntLoc->FormValue) && $this->PresuEntLoc->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEntLoc->FldCaption());
		}
		if (!$this->PresuEntTel->FldIsDetailKey && !is_null($this->PresuEntTel->FormValue) && $this->PresuEntTel->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEntTel->FldCaption());
		}
		if (!$this->PresuEntObs1->FldIsDetailKey && !is_null($this->PresuEntObs1->FormValue) && $this->PresuEntObs1->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEntObs1->FldCaption());
		}
		if (!$this->PresuEntObs2->FldIsDetailKey && !is_null($this->PresuEntObs2->FormValue) && $this->PresuEntObs2->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuEntObs2->FldCaption());
		}
		if (!$this->PresuHor->FldIsDetailKey && !is_null($this->PresuHor->FormValue) && $this->PresuHor->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->PresuHor->FldCaption());
		}
		if (!ew_CheckInteger($this->PresuHor->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuHor->FldErrMsg());
		}
		if (!ew_CheckInteger($this->PresuTipoCli->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuTipoCli->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->PresuFechaUltimaGestion->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuFechaUltimaGestion->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->PresuProximoContacto->FormValue)) {
			ew_AddMessage($gsFormError, $this->PresuProximoContacto->FldErrMsg());
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Save old values
			$rsold = &$rs->fields;
			$this->LoadDbValues($rsold);
			$rsnew = array();

			// PresuFechaCopia
			$this->PresuFechaCopia->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->PresuFechaCopia->CurrentValue, 7), NULL, $this->PresuFechaCopia->ReadOnly);

			// PresuEstado
			$this->PresuEstado->SetDbValueDef($rsnew, $this->PresuEstado->CurrentValue, NULL, $this->PresuEstado->ReadOnly);

			// PresuFacturaPto
			$this->PresuFacturaPto->SetDbValueDef($rsnew, $this->PresuFacturaPto->CurrentValue, NULL, $this->PresuFacturaPto->ReadOnly);

			// PresuFacturoTipo
			$this->PresuFacturoTipo->SetDbValueDef($rsnew, $this->PresuFacturoTipo->CurrentValue, NULL, $this->PresuFacturoTipo->ReadOnly);

			// PresuFacturaNumero
			$this->PresuFacturaNumero->SetDbValueDef($rsnew, $this->PresuFacturaNumero->CurrentValue, NULL, $this->PresuFacturaNumero->ReadOnly);

			// PresuMotivo
			$this->PresuMotivo->SetDbValueDef($rsnew, $this->PresuMotivo->CurrentValue, NULL, $this->PresuMotivo->ReadOnly);

			// PresFechaCierre
			$this->PresFechaCierre->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->PresFechaCierre->CurrentValue, 7), NULL, $this->PresFechaCierre->ReadOnly);

			// PresuReemplazado
			$this->PresuReemplazado->SetDbValueDef($rsnew, $this->PresuReemplazado->CurrentValue, NULL, $this->PresuReemplazado->ReadOnly);

			// PresuSucursal
			$this->PresuSucursal->SetDbValueDef($rsnew, $this->PresuSucursal->CurrentValue, 0, $this->PresuSucursal->ReadOnly);

			// PresuEmpresa
			$this->PresuEmpresa->SetDbValueDef($rsnew, $this->PresuEmpresa->CurrentValue, 0, $this->PresuEmpresa->ReadOnly);

			// PresuTip
			$this->PresuTip->SetDbValueDef($rsnew, $this->PresuTip->CurrentValue, "", $this->PresuTip->ReadOnly);

			// PresuLet
			$this->PresuLet->SetDbValueDef($rsnew, $this->PresuLet->CurrentValue, "", $this->PresuLet->ReadOnly);

			// PresuPun
			$this->PresuPun->SetDbValueDef($rsnew, $this->PresuPun->CurrentValue, 0, $this->PresuPun->ReadOnly);

			// PresuNum
			$this->PresuNum->SetDbValueDef($rsnew, $this->PresuNum->CurrentValue, 0, $this->PresuNum->ReadOnly);

			// PresuCli
			$this->PresuCli->SetDbValueDef($rsnew, $this->PresuCli->CurrentValue, 0, $this->PresuCli->ReadOnly);

			// PresuRaz
			$this->PresuRaz->SetDbValueDef($rsnew, $this->PresuRaz->CurrentValue, "", $this->PresuRaz->ReadOnly);

			// PresuFec1
			$this->PresuFec1->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->PresuFec1->CurrentValue, 7), ew_CurrentDate(), $this->PresuFec1->ReadOnly);

			// PresuVen
			$this->PresuVen->SetDbValueDef($rsnew, $this->PresuVen->CurrentValue, 0, $this->PresuVen->ReadOnly);

			// PresuTot
			$this->PresuTot->SetDbValueDef($rsnew, $this->PresuTot->CurrentValue, 0, $this->PresuTot->ReadOnly);

			// PresuEntDir
			$this->PresuEntDir->SetDbValueDef($rsnew, $this->PresuEntDir->CurrentValue, "", $this->PresuEntDir->ReadOnly);

			// PresuEntLoc
			$this->PresuEntLoc->SetDbValueDef($rsnew, $this->PresuEntLoc->CurrentValue, "", $this->PresuEntLoc->ReadOnly);

			// PresuEntTel
			$this->PresuEntTel->SetDbValueDef($rsnew, $this->PresuEntTel->CurrentValue, "", $this->PresuEntTel->ReadOnly);

			// PresuEntEmail
			$this->PresuEntEmail->SetDbValueDef($rsnew, $this->PresuEntEmail->CurrentValue, NULL, $this->PresuEntEmail->ReadOnly);

			// PresuEntObs1
			$this->PresuEntObs1->SetDbValueDef($rsnew, $this->PresuEntObs1->CurrentValue, "", $this->PresuEntObs1->ReadOnly);

			// PresuEntObs2
			$this->PresuEntObs2->SetDbValueDef($rsnew, $this->PresuEntObs2->CurrentValue, "", $this->PresuEntObs2->ReadOnly);

			// PresuHor
			$this->PresuHor->SetDbValueDef($rsnew, $this->PresuHor->CurrentValue, 0, $this->PresuHor->ReadOnly);

			// PresuTipoCli
			$this->PresuTipoCli->SetDbValueDef($rsnew, $this->PresuTipoCli->CurrentValue, NULL, $this->PresuTipoCli->ReadOnly);

			// PresuFechaUltimaGestion
			$this->PresuFechaUltimaGestion->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->PresuFechaUltimaGestion->CurrentValue, 7), NULL, $this->PresuFechaUltimaGestion->ReadOnly);

			// PresuProximoContacto
			$this->PresuProximoContacto->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->PresuProximoContacto->CurrentValue, 7), NULL, $this->PresuProximoContacto->ReadOnly);

			// Call Row Updating event
			$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
				$conn->raiseErrorFn = 'ew_ErrorFn';
				if (count($rsnew) > 0)
					$EditRow = $this->Update($rsnew, "", $rsold);
				else
					$EditRow = TRUE; // No field to update
				$conn->raiseErrorFn = '';
				if ($EditRow) {
				}
			} else {
				if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

					// Use the message, do nothing
				} elseif ($this->CancelMessage <> "") {
					$this->setFailureMessage($this->CancelMessage);
					$this->CancelMessage = "";
				} else {
					$this->setFailureMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$this->Row_Updated($rsold, $rsnew);
		$rs->Close();
		return $EditRow;
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "presu_presupuestoslist.php", $this->TableVar, TRUE);
		$PageId = "edit";
		$Breadcrumb->Add("edit", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($presu_presupuestos_edit)) $presu_presupuestos_edit = new cpresu_presupuestos_edit();

// Page init
$presu_presupuestos_edit->Page_Init();

// Page main
$presu_presupuestos_edit->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$presu_presupuestos_edit->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var presu_presupuestos_edit = new ew_Page("presu_presupuestos_edit");
presu_presupuestos_edit.PageID = "edit"; // Page ID
var EW_PAGE_ID = presu_presupuestos_edit.PageID; // For backward compatibility

// Form object
var fpresu_presupuestosedit = new ew_Form("fpresu_presupuestosedit");

// Validate form
fpresu_presupuestosedit.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_PresuFechaCopia");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuFechaCopia->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEstado");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuEstado->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuFacturaPto");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuFacturaPto->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuFacturaNumero");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuFacturaNumero->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuMotivo");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuMotivo->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresFechaCierre");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresFechaCierre->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuReemplazado");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuReemplazado->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuSucursal");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuSucursal->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuSucursal");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuSucursal->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEmpresa");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEmpresa->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEmpresa");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuEmpresa->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuTip");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuTip->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuLet");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuLet->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuPun");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuPun->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuPun");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuPun->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuNum");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuNum->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuNum");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuNum->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuCli");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuCli->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuCli");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuCli->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuRaz");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuRaz->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuFec1");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuFec1->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuFec1");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuFec1->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuVen");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuVen->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuVen");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuVen->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuTot");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuTot->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuTot");
			if (elm && !ew_CheckNumber(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuTot->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEntDir");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEntDir->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEntLoc");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEntLoc->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEntTel");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEntTel->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEntObs1");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEntObs1->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuEntObs2");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuEntObs2->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuHor");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($presu_presupuestos->PresuHor->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_PresuHor");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuHor->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuTipoCli");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuTipoCli->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuFechaUltimaGestion");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuFechaUltimaGestion->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_PresuProximoContacto");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($presu_presupuestos->PresuProximoContacto->FldErrMsg()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fpresu_presupuestosedit.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fpresu_presupuestosedit.ValidateRequired = true;
<?php } else { ?>
fpresu_presupuestosedit.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
// Form object for search

</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $presu_presupuestos_edit->ShowPageHeader(); ?>
<?php
$presu_presupuestos_edit->ShowMessage();
?>
<form name="fpresu_presupuestosedit" id="fpresu_presupuestosedit" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="presu_presupuestos">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table class="ewGrid"><tr><td>
<table id="tbl_presu_presupuestosedit" class="table table-bordered table-striped">
<?php if ($presu_presupuestos->PresuId->Visible) { // PresuId ?>
	<tr id="r_PresuId">
		<td><span id="elh_presu_presupuestos_PresuId"><?php echo $presu_presupuestos->PresuId->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuId->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuId" class="control-group">
<span<?php echo $presu_presupuestos->PresuId->ViewAttributes() ?>>
<?php echo $presu_presupuestos->PresuId->EditValue ?></span>
</span>
<input type="hidden" data-field="x_PresuId" name="x_PresuId" id="x_PresuId" value="<?php echo ew_HtmlEncode($presu_presupuestos->PresuId->CurrentValue) ?>">
<?php echo $presu_presupuestos->PresuId->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFechaCopia->Visible) { // PresuFechaCopia ?>
	<tr id="r_PresuFechaCopia">
		<td><span id="elh_presu_presupuestos_PresuFechaCopia"><?php echo $presu_presupuestos->PresuFechaCopia->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFechaCopia->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFechaCopia" class="control-group">
<input type="text" data-field="x_PresuFechaCopia" name="x_PresuFechaCopia" id="x_PresuFechaCopia" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFechaCopia->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFechaCopia->EditValue ?>"<?php echo $presu_presupuestos->PresuFechaCopia->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFechaCopia->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEstado->Visible) { // PresuEstado ?>
	<tr id="r_PresuEstado">
		<td><span id="elh_presu_presupuestos_PresuEstado"><?php echo $presu_presupuestos->PresuEstado->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEstado->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEstado" class="control-group">
<input type="text" data-field="x_PresuEstado" name="x_PresuEstado" id="x_PresuEstado" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEstado->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEstado->EditValue ?>"<?php echo $presu_presupuestos->PresuEstado->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEstado->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFacturaPto->Visible) { // PresuFacturaPto ?>
	<tr id="r_PresuFacturaPto">
		<td><span id="elh_presu_presupuestos_PresuFacturaPto"><?php echo $presu_presupuestos->PresuFacturaPto->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFacturaPto->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFacturaPto" class="control-group">
<input type="text" data-field="x_PresuFacturaPto" name="x_PresuFacturaPto" id="x_PresuFacturaPto" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFacturaPto->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFacturaPto->EditValue ?>"<?php echo $presu_presupuestos->PresuFacturaPto->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFacturaPto->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFacturoTipo->Visible) { // PresuFacturoTipo ?>
	<tr id="r_PresuFacturoTipo">
		<td><span id="elh_presu_presupuestos_PresuFacturoTipo"><?php echo $presu_presupuestos->PresuFacturoTipo->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFacturoTipo->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFacturoTipo" class="control-group">
<input type="text" data-field="x_PresuFacturoTipo" name="x_PresuFacturoTipo" id="x_PresuFacturoTipo" size="30" maxlength="1" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFacturoTipo->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFacturoTipo->EditValue ?>"<?php echo $presu_presupuestos->PresuFacturoTipo->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFacturoTipo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFacturaNumero->Visible) { // PresuFacturaNumero ?>
	<tr id="r_PresuFacturaNumero">
		<td><span id="elh_presu_presupuestos_PresuFacturaNumero"><?php echo $presu_presupuestos->PresuFacturaNumero->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFacturaNumero->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFacturaNumero" class="control-group">
<input type="text" data-field="x_PresuFacturaNumero" name="x_PresuFacturaNumero" id="x_PresuFacturaNumero" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFacturaNumero->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFacturaNumero->EditValue ?>"<?php echo $presu_presupuestos->PresuFacturaNumero->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFacturaNumero->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuMotivo->Visible) { // PresuMotivo ?>
	<tr id="r_PresuMotivo">
		<td><span id="elh_presu_presupuestos_PresuMotivo"><?php echo $presu_presupuestos->PresuMotivo->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuMotivo->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuMotivo" class="control-group">
<input type="text" data-field="x_PresuMotivo" name="x_PresuMotivo" id="x_PresuMotivo" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuMotivo->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuMotivo->EditValue ?>"<?php echo $presu_presupuestos->PresuMotivo->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuMotivo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresFechaCierre->Visible) { // PresFechaCierre ?>
	<tr id="r_PresFechaCierre">
		<td><span id="elh_presu_presupuestos_PresFechaCierre"><?php echo $presu_presupuestos->PresFechaCierre->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresFechaCierre->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresFechaCierre" class="control-group">
<input type="text" data-field="x_PresFechaCierre" name="x_PresFechaCierre" id="x_PresFechaCierre" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresFechaCierre->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresFechaCierre->EditValue ?>"<?php echo $presu_presupuestos->PresFechaCierre->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresFechaCierre->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuReemplazado->Visible) { // PresuReemplazado ?>
	<tr id="r_PresuReemplazado">
		<td><span id="elh_presu_presupuestos_PresuReemplazado"><?php echo $presu_presupuestos->PresuReemplazado->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuReemplazado->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuReemplazado" class="control-group">
<input type="text" data-field="x_PresuReemplazado" name="x_PresuReemplazado" id="x_PresuReemplazado" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuReemplazado->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuReemplazado->EditValue ?>"<?php echo $presu_presupuestos->PresuReemplazado->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuReemplazado->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuSucursal->Visible) { // PresuSucursal ?>
	<tr id="r_PresuSucursal">
		<td><span id="elh_presu_presupuestos_PresuSucursal"><?php echo $presu_presupuestos->PresuSucursal->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuSucursal->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuSucursal" class="control-group">
<input type="text" data-field="x_PresuSucursal" name="x_PresuSucursal" id="x_PresuSucursal" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuSucursal->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuSucursal->EditValue ?>"<?php echo $presu_presupuestos->PresuSucursal->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuSucursal->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEmpresa->Visible) { // PresuEmpresa ?>
	<tr id="r_PresuEmpresa">
		<td><span id="elh_presu_presupuestos_PresuEmpresa"><?php echo $presu_presupuestos->PresuEmpresa->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEmpresa->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEmpresa" class="control-group">
<input type="text" data-field="x_PresuEmpresa" name="x_PresuEmpresa" id="x_PresuEmpresa" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEmpresa->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEmpresa->EditValue ?>"<?php echo $presu_presupuestos->PresuEmpresa->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEmpresa->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuTip->Visible) { // PresuTip ?>
	<tr id="r_PresuTip">
		<td><span id="elh_presu_presupuestos_PresuTip"><?php echo $presu_presupuestos->PresuTip->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuTip->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuTip" class="control-group">
<input type="text" data-field="x_PresuTip" name="x_PresuTip" id="x_PresuTip" size="30" maxlength="4" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuTip->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuTip->EditValue ?>"<?php echo $presu_presupuestos->PresuTip->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuTip->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuLet->Visible) { // PresuLet ?>
	<tr id="r_PresuLet">
		<td><span id="elh_presu_presupuestos_PresuLet"><?php echo $presu_presupuestos->PresuLet->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuLet->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuLet" class="control-group">
<input type="text" data-field="x_PresuLet" name="x_PresuLet" id="x_PresuLet" size="30" maxlength="1" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuLet->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuLet->EditValue ?>"<?php echo $presu_presupuestos->PresuLet->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuLet->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuPun->Visible) { // PresuPun ?>
	<tr id="r_PresuPun">
		<td><span id="elh_presu_presupuestos_PresuPun"><?php echo $presu_presupuestos->PresuPun->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuPun->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuPun" class="control-group">
<input type="text" data-field="x_PresuPun" name="x_PresuPun" id="x_PresuPun" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuPun->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuPun->EditValue ?>"<?php echo $presu_presupuestos->PresuPun->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuPun->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuNum->Visible) { // PresuNum ?>
	<tr id="r_PresuNum">
		<td><span id="elh_presu_presupuestos_PresuNum"><?php echo $presu_presupuestos->PresuNum->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuNum->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuNum" class="control-group">
<input type="text" data-field="x_PresuNum" name="x_PresuNum" id="x_PresuNum" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuNum->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuNum->EditValue ?>"<?php echo $presu_presupuestos->PresuNum->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuNum->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuCli->Visible) { // PresuCli ?>
	<tr id="r_PresuCli">
		<td><span id="elh_presu_presupuestos_PresuCli"><?php echo $presu_presupuestos->PresuCli->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuCli->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuCli" class="control-group">
<input type="text" data-field="x_PresuCli" name="x_PresuCli" id="x_PresuCli" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuCli->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuCli->EditValue ?>"<?php echo $presu_presupuestos->PresuCli->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuCli->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuRaz->Visible) { // PresuRaz ?>
	<tr id="r_PresuRaz">
		<td><span id="elh_presu_presupuestos_PresuRaz"><?php echo $presu_presupuestos->PresuRaz->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuRaz->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuRaz" class="control-group">
<input type="text" data-field="x_PresuRaz" name="x_PresuRaz" id="x_PresuRaz" size="30" maxlength="150" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuRaz->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuRaz->EditValue ?>"<?php echo $presu_presupuestos->PresuRaz->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuRaz->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFec1->Visible) { // PresuFec1 ?>
	<tr id="r_PresuFec1">
		<td><span id="elh_presu_presupuestos_PresuFec1"><?php echo $presu_presupuestos->PresuFec1->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFec1->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFec1" class="control-group">
<input type="text" data-field="x_PresuFec1" name="x_PresuFec1" id="x_PresuFec1" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFec1->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFec1->EditValue ?>"<?php echo $presu_presupuestos->PresuFec1->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFec1->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuVen->Visible) { // PresuVen ?>
	<tr id="r_PresuVen">
		<td><span id="elh_presu_presupuestos_PresuVen"><?php echo $presu_presupuestos->PresuVen->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuVen->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuVen" class="control-group">
<input type="text" data-field="x_PresuVen" name="x_PresuVen" id="x_PresuVen" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuVen->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuVen->EditValue ?>"<?php echo $presu_presupuestos->PresuVen->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuVen->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuTot->Visible) { // PresuTot ?>
	<tr id="r_PresuTot">
		<td><span id="elh_presu_presupuestos_PresuTot"><?php echo $presu_presupuestos->PresuTot->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuTot->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuTot" class="control-group">
<input type="text" data-field="x_PresuTot" name="x_PresuTot" id="x_PresuTot" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuTot->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuTot->EditValue ?>"<?php echo $presu_presupuestos->PresuTot->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuTot->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntDir->Visible) { // PresuEntDir ?>
	<tr id="r_PresuEntDir">
		<td><span id="elh_presu_presupuestos_PresuEntDir"><?php echo $presu_presupuestos->PresuEntDir->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntDir->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntDir" class="control-group">
<input type="text" data-field="x_PresuEntDir" name="x_PresuEntDir" id="x_PresuEntDir" size="30" maxlength="250" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntDir->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntDir->EditValue ?>"<?php echo $presu_presupuestos->PresuEntDir->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntDir->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntLoc->Visible) { // PresuEntLoc ?>
	<tr id="r_PresuEntLoc">
		<td><span id="elh_presu_presupuestos_PresuEntLoc"><?php echo $presu_presupuestos->PresuEntLoc->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntLoc->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntLoc" class="control-group">
<input type="text" data-field="x_PresuEntLoc" name="x_PresuEntLoc" id="x_PresuEntLoc" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntLoc->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntLoc->EditValue ?>"<?php echo $presu_presupuestos->PresuEntLoc->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntLoc->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntTel->Visible) { // PresuEntTel ?>
	<tr id="r_PresuEntTel">
		<td><span id="elh_presu_presupuestos_PresuEntTel"><?php echo $presu_presupuestos->PresuEntTel->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntTel->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntTel" class="control-group">
<input type="text" data-field="x_PresuEntTel" name="x_PresuEntTel" id="x_PresuEntTel" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntTel->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntTel->EditValue ?>"<?php echo $presu_presupuestos->PresuEntTel->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntTel->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntEmail->Visible) { // PresuEntEmail ?>
	<tr id="r_PresuEntEmail">
		<td><span id="elh_presu_presupuestos_PresuEntEmail"><?php echo $presu_presupuestos->PresuEntEmail->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntEmail->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntEmail" class="control-group">
<input type="text" data-field="x_PresuEntEmail" name="x_PresuEntEmail" id="x_PresuEntEmail" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntEmail->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntEmail->EditValue ?>"<?php echo $presu_presupuestos->PresuEntEmail->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntEmail->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntObs1->Visible) { // PresuEntObs1 ?>
	<tr id="r_PresuEntObs1">
		<td><span id="elh_presu_presupuestos_PresuEntObs1"><?php echo $presu_presupuestos->PresuEntObs1->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntObs1->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntObs1" class="control-group">
<input type="text" data-field="x_PresuEntObs1" name="x_PresuEntObs1" id="x_PresuEntObs1" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntObs1->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntObs1->EditValue ?>"<?php echo $presu_presupuestos->PresuEntObs1->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntObs1->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuEntObs2->Visible) { // PresuEntObs2 ?>
	<tr id="r_PresuEntObs2">
		<td><span id="elh_presu_presupuestos_PresuEntObs2"><?php echo $presu_presupuestos->PresuEntObs2->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuEntObs2->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuEntObs2" class="control-group">
<input type="text" data-field="x_PresuEntObs2" name="x_PresuEntObs2" id="x_PresuEntObs2" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuEntObs2->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuEntObs2->EditValue ?>"<?php echo $presu_presupuestos->PresuEntObs2->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuEntObs2->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuHor->Visible) { // PresuHor ?>
	<tr id="r_PresuHor">
		<td><span id="elh_presu_presupuestos_PresuHor"><?php echo $presu_presupuestos->PresuHor->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $presu_presupuestos->PresuHor->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuHor" class="control-group">
<input type="text" data-field="x_PresuHor" name="x_PresuHor" id="x_PresuHor" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuHor->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuHor->EditValue ?>"<?php echo $presu_presupuestos->PresuHor->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuHor->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuTipoCli->Visible) { // PresuTipoCli ?>
	<tr id="r_PresuTipoCli">
		<td><span id="elh_presu_presupuestos_PresuTipoCli"><?php echo $presu_presupuestos->PresuTipoCli->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuTipoCli->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuTipoCli" class="control-group">
<input type="text" data-field="x_PresuTipoCli" name="x_PresuTipoCli" id="x_PresuTipoCli" size="30" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuTipoCli->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuTipoCli->EditValue ?>"<?php echo $presu_presupuestos->PresuTipoCli->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuTipoCli->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuFechaUltimaGestion->Visible) { // PresuFechaUltimaGestion ?>
	<tr id="r_PresuFechaUltimaGestion">
		<td><span id="elh_presu_presupuestos_PresuFechaUltimaGestion"><?php echo $presu_presupuestos->PresuFechaUltimaGestion->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuFechaUltimaGestion->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuFechaUltimaGestion" class="control-group">
<input type="text" data-field="x_PresuFechaUltimaGestion" name="x_PresuFechaUltimaGestion" id="x_PresuFechaUltimaGestion" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuFechaUltimaGestion->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuFechaUltimaGestion->EditValue ?>"<?php echo $presu_presupuestos->PresuFechaUltimaGestion->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuFechaUltimaGestion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($presu_presupuestos->PresuProximoContacto->Visible) { // PresuProximoContacto ?>
	<tr id="r_PresuProximoContacto">
		<td><span id="elh_presu_presupuestos_PresuProximoContacto"><?php echo $presu_presupuestos->PresuProximoContacto->FldCaption() ?></span></td>
		<td<?php echo $presu_presupuestos->PresuProximoContacto->CellAttributes() ?>>
<span id="el_presu_presupuestos_PresuProximoContacto" class="control-group">
<input type="text" data-field="x_PresuProximoContacto" name="x_PresuProximoContacto" id="x_PresuProximoContacto" placeholder="<?php echo ew_HtmlEncode($presu_presupuestos->PresuProximoContacto->PlaceHolder) ?>" value="<?php echo $presu_presupuestos->PresuProximoContacto->EditValue ?>"<?php echo $presu_presupuestos->PresuProximoContacto->EditAttributes() ?>>
</span>
<?php echo $presu_presupuestos->PresuProximoContacto->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("EditBtn") ?></button>
</form>
<script type="text/javascript">
fpresu_presupuestosedit.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$presu_presupuestos_edit->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$presu_presupuestos_edit->Page_Terminate();
?>
